package br.com.cartools.entity.car;

import java.util.List;

public class CarComponent {

	private Integer id;
	private Company companyName;
	private String componentName;
	private List<Car> compatibleCars;
	private Double price;
	
	public CarComponent(){
		
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Company getCompanyName() {
		return companyName;
	}

	public void setCompanyName(Company companyName) {
		this.companyName = companyName;
	}

	public String getComponentName() {
		return componentName;
	}

	public void setComponentName(String componentName) {
		this.componentName = componentName;
	}

	public List<Car> getCompatibleCars() {
		return compatibleCars;
	}

	public void setCompatibleCars(List<Car> compatibleCars) {
		this.compatibleCars = compatibleCars;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((companyName == null) ? 0 : companyName.hashCode());
		result = prime * result
				+ ((compatibleCars == null) ? 0 : compatibleCars.hashCode());
		result = prime * result
				+ ((componentName == null) ? 0 : componentName.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((price == null) ? 0 : price.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CarComponent other = (CarComponent) obj;
		if (companyName == null) {
			if (other.companyName != null)
				return false;
		} else if (!companyName.equals(other.companyName))
			return false;
		if (compatibleCars == null) {
			if (other.compatibleCars != null)
				return false;
		} else if (!compatibleCars.equals(other.compatibleCars))
			return false;
		if (componentName == null) {
			if (other.componentName != null)
				return false;
		} else if (!componentName.equals(other.componentName))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (price == null) {
			if (other.price != null)
				return false;
		} else if (!price.equals(other.price))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "CarComponent [id=" + id + ", companyName=" + companyName
				+ ", componentName=" + componentName + ", compatibleCars="
				+ compatibleCars + ", price=" + price + "]";
	}


}
